const express = require('express')

const app = express()

const port = 3000

// app.use((req, res) => {
//   res.json({
//     name: '章节'
//   })
// })
app.get('/name/:age', (req, res) => {
  let { age } = req.params
  res.json({
    name:'tom',
    age
  })
  // res.send('tom')
})

app.post('/name', (req, res) => {
  res.send('tom post')
})
app.listen(port, () => {
  console.log('server 启动成功');
})